package com.aaa.sso.controller;

import com.aaa.common.util.BaseController;
import com.aaa.common.util.Result;
import com.aaa.sso.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ fileName:UserController
 * @ description: 后端用户管理的登录接口
 * @ author:zhz
 * @ createTime:2023/6/16 11:28
 * @ version:1.0.0
 */
@RestController
@RequestMapping("user")
public class UserController  extends BaseController {

    //@Resource(name = "uas")
    @Autowired
    @Qualifier("uas")
    private AuthService authService;

    /**
     * 后台用户登录
     * @param userName
     * @param password
     * @return
     */
    @GetMapping("login")
    public Result  login(String userName,String password){
        //调用服务层，因为登录方法比较复杂，在服务层写代码

        return authService.auth(userName, password);
    }


    /**
     * 验证token
     * @param token
     * @return
     */
    @GetMapping("checkToken")
    public boolean  checkToken(@RequestParam("token")String token){
        //调用服务层验证
        return  authService.checkToken(token);
    }



}
